# -*- coding: utf-8 -*-

from email.mime.text import  MIMEText
from email.header import Header
import smtplib

#准备邮件
#plain:纯文本,相对与富文本
msg = MIMEText('Python 邮件测试\n','plain','utf8')
msg['From'] = Header('root','utf8')    #发件人
msg['To'] = Header('xue','utf8')   #收件人
msg['Subject'] = Header('py test','utf8')

#发送邮件
smtp = smtplib.SMTP('localhost')    #使用本机发送邮件
smtp.sendmail('root',['xue','tom'],msg.as_bytes())